package com.wn.controller;

import com.wn.model.entity.BookType;
import com.wn.service.BookTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@RestController
@RequestMapping("/bookType")
@Api(tags = "书籍分类")
public class BookTypeController {
    @Autowired
    private BookTypeService bookTypeService;
    /**
     * 查询所有的书籍分类
     */
    @GetMapping("/findAll")
    @ApiOperation("查询所有书籍分类")
    public ResponseEntity<List<BookType>> findAll() {
        List<BookType> types = bookTypeService.findAll();
        return ResponseEntity.ok(types);
    }
}

